/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.devs.benchmark.modeling;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "modelType", propOrder = {
    "inports",
    "outports"
})
@XmlSeeAlso({
    CoupledType.class,
    AtomicType.class
})
/**
 *
 * @author Alejandro Moreno
 */
public abstract class ModelType {

    @XmlAttribute(name = "name")
    protected String name;
    
    @XmlElement(nillable = true, name="inport")
    protected List<InportType> inports;
    
    @XmlElement(nillable = true, name ="outport")
    protected List<OutportType> outports;


    public ModelType() {
    }

    public ModelType(String name) {
        this.name = name;
    }

    public ModelType(String name, List<InportType> inports, List<OutportType> outports) {
        this.name = name;
        this.inports = inports;
        this.outports = outports;
    }


    public List<InportType> getInports() {
        if (inports == null) {
            inports = new ArrayList<InportType>();
        }
        return this.inports;
    }

    public List<InportType> getInports(List<InportType> inports) {
        
        if (this.inports == null) {
            this.inports = new ArrayList<InportType>(inports);
        }else
            this.inports.addAll(inports);

        return this.inports;
    }
    
    public List<OutportType> getOutports() {
        if (outports == null) {
            outports = new ArrayList<OutportType>();
        }
        return this.outports;
    }

    public List<OutportType> getOutports(List<OutportType> outports) {
        if (this.outports == null) {
            this.outports = new ArrayList<OutportType>(outports);
        }else
            this.outports.addAll(outports);

        return this.outports;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    
}
